<table class="table table-hover">
    <thead>
        <tr>
            <th>发货单号</th>
            <th>发货账号</th>
            <th>站点</th>
            <th>发货国家</th>
            <th>销售</th>
            <th>状态</th>
            <th>物流状态</th>
            <th style="max-width: 200px;">备注</th>
            <th>发货时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach($paginator as $row)
            <tr>
                <td>{{ $row->delivery_no }}</td>
                <td>{{ \App\Models\Basics\SysPlatAccount::getAccountById($row->account_id) }}</td>
                <td>{{ \App\Models\Basics\SysArea::getSysAreaById($row->area_id) }}</td>
                <td>{{ \App\Models\Basics\SysCountry::getCountryById($row->country_id) }}</td>
                <td>{{ \App\Util\User::getUsernameById($row->seller_id) }}</td>
                <td>{{ \App\Models\Delivery\FBADelivery::$_status[$row->status] }}</td>
                <td>{{ \App\Models\Delivery\FBADelivery::$_logisticsStatus[$row->logistics_status] }}</td>
                <td>{{ $row->remarks }} </td>
                <td>{{ $row->delivered_at }}</td>
                <td>
                    @if(\Encore\Admin\Facades\Admin::user()->isRole('salesperson') && \Encore\Admin\Facades\Admin::user()->id != $row->seller_id)
                        @if(\Encore\Admin\Facades\Admin::user()->can('fba.view'))
                            <a href="/xqc/delivery/fba-track-ex/{{ $row->id }}" class="btn btn-xs btn-primary">查看</a>
                        @endif
                    @else
                        @if(\Encore\Admin\Facades\Admin::user()->can('fba.view'))
                            <a href="/xqc/delivery/fba-track-ex/{{ $row->id }}" class="btn btn-xs btn-primary">查看</a>
                        @endif
                        @if($row->status >= 6 && \Encore\Admin\Facades\Admin::user()->can('fba.logistics'))
                            <button class="btn btn-xs btn-info list-logistics-modal" data-id="{{ $row->id }}" data-action="listLogistics">更新物流</button>
                        @endif
                    @endif
                </td>
            </tr>
        @endforeach
    </tbody>
</table>
<!--更新物流Modal -->
<div class="modal fade" id="listLogisticsModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <!-- 内容会加载到这里 -->
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script language="JavaScript" type="text/javascript">
    $(function () {
        //更新物流
        $('.list-logistics-modal').on('click', function(e) {
            e.preventDefault();
            var id = $(this).data('id');
            var action = $(this).data('action');
            $("#listLogisticsModal").modal({
                remote : '/xqc/delivery/fba-modal?action=' + action + '&param=' + id
            });
        });
        $("#listLogisticsModal").on("hidden.bs.modal", function() {
            $(this).removeData("bs.modal");
            $(this).find(".modal-content").children().remove();
        });
    });
</script>
